﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace StatesAndEventsTest.source
{
    public class State_MainMenu : BaseState
    {
        public State_MainMenu() : base()
        {
            mName = "Main Menu";
            mEventHandlers.Add(EventManager.Events.EVENT_A_KEY_HIT, new EventHandler(OnAKeyHit));
            mEventHandlers.Add(EventManager.Events.EVENT_S_KEY_HIT, new EventHandler(OnSKeyHit));
        }

        private void OnAKeyHit()
        {
            Console.WriteLine("Main Menu: 'A' Key has been hit!");
        }
        private void OnSKeyHit()
        {
            Console.WriteLine("Main Menu: Transitioning to Pause state...");
            GameGlobals.StateMachine.Transition("Pause");
        }
        // Parental Overrides (forced)
        public override void  Init()
        {
            Console.WriteLine("Main Menu Init()...");
 	        //throw new System.NotImplementedException();
        }

        public override void Enter()
        {
            Console.WriteLine("Main Menu Enter()...");
            //throw new NotImplementedException();
        }

        public override void Update(GameTime gameTime)
        {
            //Console.WriteLine("Main Menu Update()...");
            //throw new NotImplementedException();
        }

        public override void Exit()
        {
            Console.WriteLine("Main Menu Exit()...");
            //throw new NotImplementedException();
        }

        public override void HandleEvent(EventManager.Events eve)
        {
            if (mEventHandlers.ContainsKey(eve))
            {
                mEventHandlers[eve]();
            }
        }
    }
}
